#!/bin/bash
# backup jenkins
cd /opt/apps
tar -zcf /opt/jenkins_backup/jenkins-`date +%Y%m%d`.tar.gz --exclude=jenkins_home/workspace/*  jenkins_home
cd /opt/jenkins_backup
rm -rf jenkins-`date +%Y%m%d -d "-5 days"`.tar.gz
#rsync  -av  --delete /opt/jenkins_backup  root@10.31.249.163:/data/